<template class="body-1">
    <div class="body-2">
        <el-container>
            <el-aside width="210px">

                <el-row class="tac">
                    <el-col :span="12">
                        <el-menu router default-active="2" class="el-menu-vertical-demo" @open="handleOpen"
                            @close="handleClose" background-color="#304156" text-color="#fff"
                            active-text-color="#409eff">
                            <el-menu-item index="/index">
                                <i class="el-icon-collection"></i>
                                <span slot="title">追光人书城</span>
                            </el-menu-item>
                            <el-submenu index="1">
                                <template slot="title">
                                    <i class="el-icon-s-tools"></i>
                                    <span>后台管理</span>
                                </template>
                                <el-menu-item-group>
                                    <el-menu-item index="/index/user">
                                        <i class="el-icon-user-solid"></i>
                                        <span>用户管理</span>
                                    </el-menu-item>
                                    <el-menu-item index="/index/book">
                                        <i class="el-icon-notebook-2"></i>
                                        <span>图书管理</span>
                                    </el-menu-item>
                                    <el-menu-item index="/index/cart">
                                        <i class="el-icon-shopping-cart-2"></i>
                                        <span>购物车管理</span>
                                    </el-menu-item>
                                    <el-menu-item index="/index/category">
                                        <i class="el-icon-s-cooperation"></i>
                                        <span>分类管理</span>
                                    </el-menu-item>
                                </el-menu-item-group>
                            </el-submenu>
                        </el-menu>
                    </el-col>
                </el-row>

            </el-aside>
            <el-container>
                <el-header>
                    
                    <div class="header-breadcrumb">
                        <el-breadcrumb separator-class="el-icon-arrow-right">
                            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                            <router-view name="breadcrumbitem1"></router-view> 
                            <router-view name="breadcrumbitem2"></router-view>
                        </el-breadcrumb>
                    </div>
                    <div class="header-dropdown">
                        <el-dropdown @command="handleCommand">
                            <span class="el-dropdown-link">
                                功能菜单<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu  slot="dropdown">
                                <el-dropdown-item command="http://localhost:8080/">网页首页</el-dropdown-item>
                                <el-dropdown-item divided command="login">退出登录</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>

                </el-header>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>

</template>

<script>
export default {
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },
        login(){
        this.$router.push('/index');
        },
        handleCommand(command) {
            window.location.href=command 
        }
    }
}
</script>
<style>

.header-dropdown {
    position: absolute;
    top: 0;
    right: 0px;
    width: 100px;
}
.el-header {

    border: 1px solid #EBEEF5;
}
.header-breadcrumb {
    width: 400px;
    /* display: inline; */
}

.el-breadcrumb {
    width: 300px;
}
.el-breadcrumb {
    font-size: 14px;
    line-height: 4;
}
.el-container {
    width: 100%;
    height: 100%;

}
.el-col {
    width: 210px;
}

.el-header,
.el-footer {
    background-color: #fdfdfd;
    color: #333;
    /* text-align: center; */
    line-height: 50px;
}

.el-aside {
    background-color: #304156;
    color: #333;
    text-align: center;
    line-height: 200px;
}

.el-main {
    background-color: #fdfdfd;
    color: #333;
    /* text-align: center; */


    min-height: calc(100vh - 60px);
    width: 100%;
    position: relative;
    overflow: hidden;
    display: block;
}

body>.el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
}
</style>